package com.adong.springboot.controller;

import com.adong.springboot.exception.UserNotExistException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


@Controller
public class HelloController {

    @ResponseBody
    @RequestMapping("/hello")
    public String hello(@RequestParam("user") String user) {
        if ("aaa".equals(user)) {
            throw new UserNotExistException();
        }
        return "hello world";
    }


    /*@RequestMapping("/success")
    public String success(Map<String, Object> map) {
        map.put("hello", "<h1>测试<h2>");
        map.put("users", Arrays.asList("1,2,3"));
        return "success"; //classpath:thymeleaf
    }*/


}
